﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<script>
	$(function(){
		var page = "${ACTIVE_PAGE}";
		$("#"+page).attr("class", "active");
		
		$("#menu li").click(function(e){
			$(".loader").fadeOut("slow");
			var a = $(this).find("a");
			var href = a.attr("href");
			var id = a.attr("id");
			if(id === "logout"){
				$.Dialog({
					width: 250,
					overlay: true,
					shadow: true,
					flat: true,
					icon: '<div class="fg-black icon-locked"></div>',
					title: '<div class="fg-black bold" style="font-weight: bold;">ออกจากระบบ</div>',
					content: $("#dlg").html(),
					sysButtons:{
						btnClose: false
					}
				});
				return false;
			}
			
			window.location = href;
			return false;
		});
		
		$.alert = function(title, msg){
			$("#alertMsg").html(msg);
			$.Dialog({
				width: 350,
				height: 100,
				overlay: true,
				shadow: true,
				flat: true,
				icon: '<div class="fg-black icon-warning"></div>',
				title: '<div class="fg-black bold" style="font-weight: bold;">'+title+'</div>',
				content: $("#alertDlg").html(),
				sysButtons:{
					btnClose: false
				}
			});
		}
	});
</script>

<nav class="sidebar custom-blue">
	<ul id="menu">
		<li id="news"><a href="${pageContext.request.contextPath}/backdoor/news"><i class="icon-newspaper"></i>ข่าวหน้าหลัก</a></li>
		<li id="slides"><a href="${pageContext.request.contextPath}/backdoor/slides"><i class="icon-pictures"></i>ภาพสไลด์</a></li>
		<li id="documents"><a href="${pageContext.request.contextPath}/backdoor/documents"><i class="icon-file"></i>เอกสาร</a></li>
		<li id="relativeWebsites"><a href="${pageContext.request.contextPath}/backdoor/relativeWebsites"><i class="icon-share-2"></i>เว็บไซต์ที่เกี่ยวข้อง</a></li>
		<li id="relativePrograms"><a href="${pageContext.request.contextPath}/backdoor/relativePrograms"><i class="icon-screen"></i>โปรแกรมที่เกี่ยวข้อง</a></li>  
		<li id="account"><a href="${pageContext.request.contextPath}/backdoor/account"><i class="icon-user"></i>ผู้ใช้งานระบบ</a></li>  
		<li><a id="logout" href="#"><i class="icon-locked"></i>ออกจากระบบ</a></li>
	</ul>
</nav>

<div id="dlg" style="display:none;">
	<form action="${pageContext.request.contextPath}/backdoor/logout">
		<div class="fg-black" style="text-align: center;">
			<div style="margin: 30px; margin-top: 10px;">ต้องการออกจากระบบ?</div>
			<div>
				<button class="button primary" id="btnLogout" name="btnLogout">Logout</button>
				<button class="button" type="button" onclick="$.Dialog.close()">Cancel</button>
			</div>
		</div>
	</form>
</div>	
<div id="alertDlg" style="display:none;">
	<div class="fg-black" style="text-align: center;">
		<div style="margin: 30px; margin-top: 10px;" id="alertMsg"></div>
		<div>
			<button class="button" type="button" onclick="$.Dialog.close()">OK</button>
		</div>
	</div>
</div>